package com.min.netty.file.constant;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.nio.charset.StandardCharsets;

/**
 * 常量类
 *
 * @author BBF
 */
public class Constant {

  public static final String NOT_VALID_FILE = "%s，不是有效的文件";
  public static final String UNABLE_READ_FILE = "%s，文件不可读";
  public static final ByteBuf SEND_CORRECT_DATA;

  static {
    SEND_CORRECT_DATA = Unpooled.copiedBuffer("请发送正确的数据", StandardCharsets.UTF_8);
  }

  /**
   * 标记RandomAccessFile的只读属性
   */
  public static final String FILE_READ = "r";

  /**
   * 标记RandomAccessFile的读写属性
   */
  public static final String FILE_WRITE = "rw";
  /**
   * 单次发送数据长度，10KB
   */
  public static final int SEND_SIZE = 10240;

  /**
   * 开始传输
   */
  public static final int TRANSMIT_START = 0;

  /**
   * MD5存在，秒传完毕
   */
  public static final int TRANSMIT_MD5_EXISTS = -10;
}
